package com.github.postsanf.yinian.service;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;

import com.github.postsanf.yinian.activity.MainActivity;
import com.github.postsanf.yinian.constants.ACTIONs;

public class NoticeBroadcast extends BroadcastReceiver {
    //该方法用于实现接收到广播的具体处理，其中参数intent：为接受到的intent
    @Override
    public void onReceive(Context context, Intent intent) {
        //获取意图的动作
        String mAction = intent.getAction();
//        if (ACTIONs.actionAlbumNotice_LANGUE.equals(mAction)) {
        Log.i("xjs", "actionAlbumNotice_LANGUE");
        context.startActivity(new Intent(context, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
        final Context mContext = context;
        final int groupid = intent.getIntExtra("groupid", 0);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent1 = new Intent(ACTIONs.actionAlbumNotice);
                intent1.putExtra("groupid", groupid);
                mContext.sendBroadcast(intent1);
            }
        }, 1000);

//        }
    }
}